<template>
  <div id="app">
    <MyHeader title="购物车案例"></MyHeader>
    <div class="main">
      <MyGoods v-for="obj in list" :key="obj.id" :obj="obj"></MyGoods>
    </div>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    // console.log(this);
    this.$axios({
      method: "get",
      url: "/api/cart ",
    }).then((res) => {
      console.log(res);
      this.list = res.data.list;
      console.log(this.list);
    });
  },
};
</script>

<style scoped>
.main {
  padding-top: 40px;
  padding-bottom: 40px;
}
</style>